﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DECOR.BL.BE;
using DECOR.DL.DALCF;

namespace DECOR.BL.BC
{
    public class StockBC
    {
        #region Singleton
        private StockBC() { }
        private static StockBC _instance = null;
        public static StockBC Instance
        {
            get { return (_instance == null) ? _instance = new StockBC() : _instance; }
        }
        #endregion
                
        public List<GenericBE> listarLotes(string pCodMaterial, string pCodCentro, string pCodAlmacen, decimal pCant, string pNumPedido, out string pCodLoteOptimo)
        {
            return DaoFactory.LoteDALC.listar(pCodMaterial.PadLeft(18, '0'), pCodCentro, pCodAlmacen, pCant, pNumPedido, out pCodLoteOptimo);
        }

        public List<StockBE> buscarStock(StockBE pObjStock)
        {
            if (!string.IsNullOrEmpty(pObjStock.CodMaterial))
            {
                pObjStock.CodMaterial = pObjStock.CodMaterial.Length < 18 ? pObjStock.CodMaterial.PadLeft(18, '0') : pObjStock.CodMaterial;
            }
            return DaoFactory.StockDALC.buscarStock(pObjStock);
        }

        public List<StockBE> buscarStockEC(StockBE pObjStock)
        {
            if (!string.IsNullOrEmpty(pObjStock.CodMaterial))
            {
                pObjStock.CodMaterial = pObjStock.CodMaterial.Length < 18 ? pObjStock.CodMaterial.PadLeft(18, '0') : pObjStock.CodMaterial;
            }
            return DaoFactory.StockDALC.buscarStockEC(pObjStock);
        }

        public List<StockCursoBE> buscaStockECTRansito(string numMat, string matDesc, string numDoc,
            DateTime fechaIni, DateTime fechaFin)
        {
            return DaoFactory.StockDALC.buscaStockECTRansito(numMat, matDesc, numDoc, fechaIni , fechaFin);
        }
    }
}
